home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr52 / ncclib.zip / NCCDEMO.ZIP / G_NET.PRG < prev    next >
Text File  |  1992-10-21  |  2KB  |  142 lines

  1. //═══════════════════════════════════════════════════════╕
  2. //  Program .....: G_Net                                 │
  3. //  CopyRight ...: 1992 National Computer Consultants    │
  4. //                 All rights are reserved.              │
  5. //  Author ......: Greg Rice                             │
  6. //═══════════════════════════════════════════════════════╛
  7.  
  8. #include "error.ch"
  9.  
  10.  
  11. FUNCTION fflock()
  12.  
  13.     WHILE ! flock()
  14.       tell_mesg('File could not be locked ... Retry (Y/N)')
  15.  
  16.       IF upper(chr(lastkey())) == 'N'
  17.         RETURN .f.
  18.  
  19.       END
  20.  
  21.       inkey(3)
  22.  
  23.     END
  24.  
  25. RETURN .t.
  26.  
  27.  
  28. FUNCTION rrlock()
  29.  
  30.     WHILE ! rlock()
  31.       tell_mesg('Record currently locked by another user ... Retry (Y/N)')
  32.  
  33.       IF upper(chr(lastkey())) == 'N'
  34.         RETURN .f.
  35.  
  36.       END
  37.  
  38.       inkey(3)
  39.  
  40.     END
  41.  
  42. RETURN .t.
  43.  
  44.  
  45. FUNCTION ffexcl( x )
  46.  
  47.     WHILE .t.
  48.  
  49.       use ( x ) exclusive
  50.  
  51.       IF ! neterr()
  52.         exit
  53.  
  54.       END
  55.  
  56.       tell_mesg('Could not get exclusive rights ... Retry (Y/N)')
  57.  
  58.       IF upper(chr(lastkey())) == 'N'
  59.         RETURN .f.
  60.  
  61.       END
  62.  
  63.       inkey(3)
  64.  
  65.     END
  66.  
  67. RETURN .t.
  68.  
  69.  
  70. FUNCTION ffshare( x )
  71.  
  72.     local objError, lRetVal := .t.
  73.  
  74.  
  75.     BEGIN SEQUENCE
  76.       WHILE .t.
  77.         use ( x ) shared
  78.  
  79.         IF ! neterr()
  80.           exit
  81.  
  82.         END
  83.  
  84.         tell_mesg('Cannot open file in shared mode ... Retry (Y/N)')
  85.  
  86.         IF upper(chr(lastkey())) == 'N'
  87.           lRetVal := .f.
  88.           exit
  89.  
  90.         END
  91.  
  92.         inkey(3)
  93.  
  94.       END
  95.  
  96.     RECOVER USING objError
  97.       if objError:genCode == EG_CORRUPTION
  98.         lRetVal := .f.
  99.       endif
  100.  
  101.     END SEQUENCE
  102.  
  103. Return( lRetVal )
  104.  
  105.  
  106. FUNCTION ffadd()
  107.  
  108.     WHILE .t.
  109.       appe blank
  110.  
  111.       IF ! neterr()
  112.         exit
  113.  
  114.       END
  115.  
  116.       tell_mesg('Could not add record ... Retry (Y/N)')
  117.  
  118.       IF upper(chr(lastkey())) == 'N'
  119.         RETURN .F.
  120.  
  121.       END
  122.  
  123.       inkey(3)
  124.     END
  125.  
  126. Return( .t. )
  127.  
  128.  
  129. STATIC FUNCTION tell_mesg(x)
  130.  
  131.     LOCAL y, x_buf := savescreen(3,10,6,69)
  132.  
  133.     keyboard ''
  134.     y := setcolor()
  135.     setcolor(popup_color())
  136.     WinBox(3,10,5,67,0,4,.t.)
  137.     NccMesg(x,4,'center,10,67',,0)
  138.     restscreen(3,10,6,69,x_buf)
  139.     setcolor(y)
  140.  
  141. RETURN NIL
  142.